// pages/record/index.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    devicePosition: 'front',
    isRecord: false,
  },

  handeRecord() {
    const ctx = wx.createCameraContext();

    if (this.data.isRecord) {
      this.setData({ isRecord: false });
      ctx.stopRecord({
        success: (res) => {
          console.log(res, 9999);
        },
      });
    } else {
      this.setData({ isRecord: true });
      ctx.startRecord({
        success: (res) => {
          console.log(res, 111);
        },
      });
    }
  },

  handleTranslate() {
    const { devicePosition } = this.data;
    this.setData({
      devicePosition: devicePosition == 'front' ? 'back' : 'front',
    });
  },
});
